<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Renew extends Model
{
    // Table
    protected $table = 'renews';

    // The attributes that aren't mass assignable.
    protected $guarded = ['referer'];

    // 业务员
    public function saler()
    {
        return $this->belongsTo('App\Models\User', 'saler_id');
    }

    // 订单
    public function order()
    {
    	return $this->belongsTo('App\Models\Order');
    }

    // 合同
    public function contract()
    {
        return $this->hasOne('App\Models\Contract', 'contract_no', 'contract_no'); 
    }
}
